﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI.WebControls;
using Framework.Library.Base.Base;
using Framework.Library.Base.Extensions;
using Framework.Library.Core.Utils;
using Framework.Library.Data.DAL;
using Framework.Library.Data.DAL.JObject;
using Framework.Library.Data.DAO;
using ServiceStack.Text;
using System.Linq;
using Framework.Library.Core.Utils.BBCodeParse;

namespace Framework.Portal.Layouts.Client.Components.Teenio
{
    public partial class Guilde : BaseControl
    {
        public string MENUNAME = string.Empty;

        public Guilde()
        {
        }

        public Guilde(JSection section)
        {
            if (!string.IsNullOrEmpty(section.parameter))
            {
                string[] arrParams = section.parameter.Split('&');
                if (arrParams.Length > 0)
                    catId = Convert.ToInt32(arrParams[0].Split('=')[1]);
            }
            MENUNAME = section.title;
        }

        protected static int catId = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblCommandName.Text = MENUNAME;
                if (catId > 0)
                {
                    TeenioContent info = ManagerFactory.TeenioContentManager.GetContentIntro(catId);
                    if (info != null)
                    {
                        lblContent.Text = BBCodeUtils.GetParser(info.CONTENT_BODY, ErrorMode.Strict);
                    }
                }
            }
        }
    }
}